<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="SubscribeService" 
    Title="Hackystat Event Registration" Codebehind="SubscribeService.aspx.cs" %>
<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="contentpanel" Runat="Server">
    
    <asp:Label ID="Title_Text" runat="server" Text="Subscribed Events List" 
        Font-Bold="True" Font-Size="X-Large"></asp:Label>
    <br />
    <br />
    
    <asp:DataList ID="ServiceList" runat="server" DataSourceID="AvailableServicesXML" 
        OnItemDataBound="checkServices">
        <HeaderTemplate>
            <asp:TableHeaderRow>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="Services"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="(Optional) XPath Query Filter"></asp:Label>
                </td>
            </asp:TableHeaderRow>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <input id="serviceCheckbox" type="checkbox" 
                        name=<%# DataBinder.Eval(Container.DataItem, "Type") %>
                        runat="server" value=<%# DataBinder.Eval(Container.DataItem, "Type") %>/>
                </td>
                <td><asp:Label ID="serviceName" runat="server" Text='<%# Eval("Name") %>' /></td>
                <td>
                    <asp:TextBox ID="serviceFilter" runat="server" Text="" 
                        Width="400px" />
                    <asp:CustomValidator id="CorrectXPath" runat="server"
                        ControlToValidate="serviceFilter"
                        OnServerValidate="XPathFilterValidate"
                        ErrorMessage="* The XPath query filter is invalid."
                        Display="dynamic">*
                    </asp:CustomValidator>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            <asp:TableRow>
                <td></td>
                <td>
                    <asp:Button ID="Apply" runat="server" Text="Apply" OnClick="UpdateServices"/>
                </td>
            </asp:TableRow>
        </FooterTemplate>
    </asp:DataList>

    <br />

    <asp:ValidationSummary id="valSummary" runat="server"
        HeaderText="Errors:"
        ShowSummary="true" DisplayMode="List" />
    
    <asp:Button ID="Back" runat="server" PostBackUrl="~/Default.aspx" Text="Back" />&nbsp;
    <asp:Button ID="SuperSubscribe" runat="server" Text="Subscribe All" OnClick="SuperSubscribeClick" />&nbsp;
    <asp:Button ID="Refresh" runat="server" OnClick="RefreshClick" Text="Refresh" />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="UnsubscribeAll" runat="server" OnClick="UnsubscribeAllClick" Text="UnsubscribeAll" /><br />
    <hr />
    <asp:TextBox ID="TextOutput" runat="server" ReadOnly="True" 
        TextMode="MultiLine" BorderStyle="None" Height="200px" Width="600px" 
        Wrap="False">Output:</asp:TextBox>&nbsp;
    <asp:XmlDataSource ID="AvailableServicesXML" runat="server" DataFile="~/Services.xml"
        TransformFile="~/Services.xsl"></asp:XmlDataSource>
</asp:Content>

